
<script type="text/javascript" language="javascript">
    <!--
    $(document).ready(function() {
        // If your site is large with many images use window.load instead
        //$(window).load(function() {
        //Default Action
        $(".tab_content").hide();
        $("ul.tabs li:first").addClass("active").show(); 
        $(".tab_content:first").show(); 
    
        //On Click Event
        $("ul.tabs li").click(function() {
            $("ul.tabs li").removeClass("active");
            $(this).addClass("active"); 
            $(".tab_content").hide(); 
            var activeTab = $(this).find("a").attr("href"); 
            $(activeTab).fadeIn();
            if(activeTab == '#tab2') {      
                $(window).resize(function(){
                    //$("#tab2").css({'display':'block'});
                    //$("#map_canvas").css({'width':'630px', 'height':'400px'});
                    //initialize();
                    //alert('Changed!');
                }); 
            }   
            return false;
        });
    });
    -->
</script>
<script type="text/javascript">

    $(function () {
    
        // Slideshow 3
        $("#slider3").responsiveSlides({
            manualControls: '#slider3-pager',
            maxwidth: 540
        });
    });
</script>

<?php
$jenis = array('1' => 'rumah', '2' => 'apartemen', '3' => 'tanah', '4' => 'ruko dan kios',
    '5' => 'ruang kantor', '6' => 'indekost', '7' => 'hotel dan villa', '8' => 'gudang', '9' => 'lainnya');
$beli = array('1' => 'dijual', '2' => 'disewa', '3' => 'dilelang');

$sertifikasi = array('1' => 'SHM-Sertifikat', '2' => 'Hak Milik', '3' => 'HGB', '4' => 'lainnya(PPJB,adat,dll)');
$furnitur = array('1' => 'Fully furnished', '2' => 'Semi furnished', '3' => 'Unfurnished');
$fasilitas = array('1' => 'kolam renang', '2' => 'gym', '3' => 'sauna', '4' => 'tennis court',
    '5' => 'jogging track', '6' => 'function room', '7' => 'children play ground', '8' => 'ATM', '9' => 'mini market',
    '10' => 'library', '11' => 'shopping center', '12' => 'entertainment center');
?>

<div class="page detail_properti_baru">
    <div class="container">
        <h2>
            <?php
            echo ucfirst($output['properti']['nama']);
            echo ' (' . $beli[$output['properti']['sewa_beli']] . ')';
            ?>
        </h2>
        <div class="row">            
            <div class="span7">
                <?php
                echo '';
                echo '<h4 class="harga">Harga : ';
                echo "Rp. " . number_format($output['properti']['harga']) . '</h4><p>';
                echo 'Alamat : ';
                echo $output['properti']['alamat']['jalan'];
                if ($output['properti']['alamat']['kota_kab'] != 'default') {
                    echo ', ' . $output['properti']['alamat']['kota_kab'];
                }
                if ($output['properti']['alamat']['provinsi'] != 'default') {
                    echo ', ' . $output['properti']['alamat']['provinsi'];
                }
                echo '</p>';
                ?>

                <ul class="tabs">
                    <li><a href="#tab1">Photos</a></li>
                    <li><a href="#tab2" id="showMap">Map</a></li>
                    <li><a href="#tab3">Bird's Eye</a></li>
                </ul>
                <!-- Start tab container -->
                <div class="tab_container">
                    <div id="tab1" class="tab_content">
                        <!-- Photos -->
                        <ul class="resslides" id="slider3">
                            <?php
                            if ($output['properti']['picture'] != null) {
                                foreach ($output['properti']['picture'] as $pic) {
                                    echo '<li>';
                                    echo '<img src="' . base_url() . 'pictures/properti/' . $pic . '">';
                                    echo '</li>';
                                }
                            } else {
                                echo '<li>';
                                echo '<img src="' . base_url() . 'assets/img/rumah_default3.png">';
                                echo '</li>';
                            }
                            ?> 
                          <!-- <li><img src="<?php echo base_url(); ?>assets/img/images1.jpg" alt=""></li>
                          <li><img src="<?php echo base_url(); ?>assets/img/images1.jpg" alt=""></li> -->

                        </ul>

                        <!-- Slideshow 3 Pager -->
                        <ul id="slider3-pager">
                            <?php
                            if ($output['properti']['picture'] != null) {
                                foreach ($output['properti']['picture'] as $pic) {
                                    $url = base_url() . 'pictures/properti/' . $pic;
                                    echo '<li>';
                                    echo '<a href="#">';
                                    echo '<img width="50px" height="50px" src="' . $url . '">';
                                    echo '</a>';
                                    echo '</li>';
                                }
                            } else {
                                // echo '<li>';
                                // echo '<img src="'.base_url().'assets/img/rumah_default2.gif">';
                                // echo '</li>';
                                //echo "<li>belum ada foto</li>";
                            }
                            ?>
                          <!-- <li><a href="#"><img width="50px" height="50px" src="<?php echo base_url(); ?>assets/img/images1.jpg" alt=""></a></li>
                          <li><a href="#"><img width="50px" height="50px" src="<?php echo base_url(); ?>assets/img/images1.jpg" alt=""></a></li>
                            -->
                        </ul>        
                    </div>

                    <div id="tab2" class="tab_content">
                        <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
                        <script type="text/javascript" language="javascript">
                            //<![CDATA[
                            $(document).ready(function() {
    
                                function initialize() {
                                    var myLatlng = new google.maps.LatLng(<?php echo $output['properti']['alamat']['lat']; ?>, <?php echo $output['properti']['alamat']['long']; ?>);
                                    var myOptions = {
                                        zoom: 10,
                                        center: myLatlng,
                                        mapTypeId: google.maps.MapTypeId.ROADMAP
                                    }
        
                                    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
        
                                    var contentString = '<?php echo $output['properti']['alamat']['jalan']; ?>';
    
                                    var infowindow = new google.maps.InfoWindow({
                                        content: contentString,
                                        maxWidth: 300
                                    });
    
                                    var marker = new google.maps.Marker({
                                        position: myLatlng,
                                        map: map,
                                        title: ''
                                    });
                                    google.maps.event.addListener(marker, 'click', function() {
                                        infowindow.open(map,marker);
                                    });
    
                                }
                                // Function added to help reset map and container boundaries
                                $("#showMap").click(function() {
                                    $("#tab2").css({'display':'block'});
                                    $("#map_canvas").css({'width':'100%', 'height':'350px'});
                                    initialize();
                                    //alert('showMap Clicked!');
                                });
        
                                initialize(); 

                            });
                            //]]>
                        </script>
                        <div id="map_canvas" style="width:100%;height:350px;">
                            <?php
                            echo $map['js'];
                            echo $map['html'];
                            ?>
                        </div>
                    </div>

                    <div id="tab3" class="tab_content">
                        Bird's eye
                    </div>

                </div>
                <!-- End tab container -->

                <div class="span7 tab_detailproperti">
                    <ul class="nav nav-tabs" id="myTab">                        
                        <li class="active"><a href="#detail" data-toggle="tab">Overview</a></li>
                        <li><a href="#desc" data-toggle="tab">Deskripsi</a></li>
                        <li><a href="#fasilitas" data-toggle="tab">Fasilitas</a></li>
                        <li><a href="#request" data-toggle="tab">Request</a></li>
                        <li><a href="#design" data-toggle="tab">Desain & Interior</a></li>
                    </ul>

                    <div id="myTabContent" class="tab-content">                        
                        <div class="tab-pane active" id="detail">
                            <table class="table table-striped">
                                <?php
                                $det = array(
                                    'Diiklankan sejak' => $output['properti']['tgl_upload'],
                                    'Tipe properti' => $jenis[$output['properti']['tipe']],
                                    'Harga' => $output['properti']['harga'],
                                    'Jml kamar tidur' => $output['properti']['jml_kmr_tidur'],
                                    'Jml kamar mandi' => $output['properti']['jml_kmr_mandi'],
                                    'Jml kamar pembantu' => $output['properti']['jml_kmr_pembantu'],
                                    'Info sekolah dan rumah sakit' => ($output['properti']['info_sekolah_rs'] ? $output['properti']['info_sekolah_rs'] : "-"),
                                    'Info interior' => ($output['properti']['info_interior'] ? $output['properti']['info_interior'] : "-"),
                                    'Luas tanah' => $output['properti']['luas_tanah'] . ' m2',
                                    'Luas bangunan' => $output['properti']['luas_bangunan'] . ' m2',
                                    'Tahun didirikan' => $output['properti']['tahun_didirikan'],
                                    'Sertifikasi' => $sertifikasi[$output['properti']['sertifikasi']],
                                    'Furnitur' => $furnitur[$output['properti']['furnitur']]);

                                foreach ($det as $key => $value) {
                                    echo '<tr><td>' . $key . '</td><td>' . $value . '</td></tr>';
                                }
                                ?>
                            </table>                            
                        </div>
                        <div class="tab-pane" id="desc">
                            <?php
                            if ($output['properti']['deskripsi'] != "") {
                                echo $output['properti']['deskripsi'];
                            } else {
                                echo 'Belum ada deskripsi';
                            }
                            ?>
                        </div>
                        <div class="tab-pane" id="fasilitas">
                            <?php if (count(array_keys($output['properti']['fasilitas'], 0)) != count($output['properti']['fasilitas'])) { ?>
                                <table class="table table-striped table-bordered table-hover">
                                    <?php
                                    foreach ($output['properti']['fasilitas'] as $key => $value) {
                                        if ($value == 1) {
                                            echo '<tr><td>';
                                            echo $key;
                                            echo '</td></tr>';
                                        }
                                    }
                                    ?>
                                </table>
                                <?php
                            } else {
                                echo 'Tidak ada fasilitas tambahan';
                            }
                            ?>
                        </div>
                        <div class="tab-pane" id="request">
                            <form action="" id="input-form" class="form-horizontal">
                                <div class="modal-body">       
                                    <div class="control-group">
                                        <label class="control-label" for="titel">Titel:</label>
                                        <div class="controls">
                                            <select name="titel" id="titel" class="span3">
                                                <option value="0">Bapak</option>
                                                <option value="1">Ibu</option>
                                                <option value="2">Sdr/i</option>
                                            </select>
                                        </div> 
                                    </div>      
                                    <div class="control-group">
                                      <label class="control-label" for="name">Nama Anda</label>
                                      <div class="controls">
                                        <input type="text" class="input-xlarge" name="name" id="name">
                                      </div>
                                    </div>
                                    <div class="control-group">
                                      <label class="control-label" for="email">Alamat E-mail:</label>
                                      <div class="controls">
                                        <input type="text" class="input-xlarge" name="email" id="email">
                                      </div>
                                    </div>
                                    <div class="control-group">
                                          <label class="control-label" for="tel">No. HP:</label>
                                          <div class="controls">
                                            <input type="tel" class="input-xlarge" name="tel" id="tel">
                                          </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="status">Saya adalah:</label>
                                        <div class="controls">
                                            <select name="status" id="status" class="select-block">
                                                <option value="0">Pembeli</option>
                                                <option value="1">Pemilik</option>
                                                <option value="2">Penyewa</option>
                                                <option value="3">Agen</option>
                                                <option value="4">Investor</option>
                                                <option value="5">Lain-lain</option>
                                            </select>
                                        </div> 
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label" for="pesan">Pesan</label>
                                        <div class="controls">
                                            <textarea style="width:300;" name="pesan"></textarea>
                                        </div>
                                                                                
                                    </div>
                                    <input type="hidden" value="<?php echo $output['properti']['kode']; ?>">
                                    <label class="checkbox" for="checkbox_berlangganan">
                                        <input type="checkbox" name="mau_proyek" for="mau_proyek" value="1" id="checkbox_berlangganan" data-toggle="checkbox">
                                        Saya ingin menerima news letter dari Anda
                                    </label>
                                    <label class="checkbox" for="checkbox_info_baru">
                                        <input type="checkbox" name="mau_info" for="mau_info" value="1" id="checkbox_info_baru" data-toggle="checkbox">
                                        Saya ingin menerima property news Alert dari ArtyProperty.Com
                                    </label>
                                    <div class="span4 offset2">
                                        <input type="submit" name="SUBMIT"  class="btn btn-primary btn-large span3" value="Submit" />
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="tab-pane" id="design">design
                        </div>
                    </div>
                    <script>
                        $(function () {
                            $('#myTab a:first').tab('show');
                        })
                    </script>
                </div>
            </div>
            <div class="span5">
                <div class="span4">
                    <!-- AddThis Button BEGIN -->
                    <div class="addthis_toolbox addthis_default_style addthis_32x32_style">
                    <a class="addthis_button_preferred_1"></a>
                    <a class="addthis_button_preferred_2"></a>
                    <a class="addthis_button_preferred_3"></a>
                    <a class="addthis_button_preferred_4"></a>
                    <a class="addthis_button_compact"></a>
                    <a class="addthis_counter addthis_bubble_style"></a>
                    </div>
                    <script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
                    <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-526b895966cc7de1"></script>
                    <!-- AddThis Button END -->
                </div>
                <br/><br/>
                <div class="span4 infoagen">
                    <div class="row">
                        <div class="span1 fotoagen">
                            <?php
                            $url = "";
                            if ($output['agen']['picture'] != "") {
                                $url = base_url() . 'pictures/user/thumb/' . $output['agen']['picture'];
                            } else {
                                $url = base_url() . 'assets/img/person.jpg';
                            }
                            ?>
                            <img src="<?php echo $url; ?>" class="img-polaroid">
                        </div>
                        <div class="span3">
                            <h4><?php echo ucfirst($output['agen']['nama_depan']) . ' ' . ucfirst($output['agen']['nama_belakang']); ?></h4>
                            <p class="palette-paragraph">
                            HP: <?php echo $output['agen']['no_hp']; ?> <br/>
                            Listing Aktif: <?php echo $output['agen']['jml_listing']; ?></p>
                            <a href="#hubungiAgen" data-toggle="modal" class="btn">Kontak Agen</a>
                        </div>
                    </div>

                </div>
                <div class="span4 infoagen">
                    <h4>Brokered By: <?php echo $output['perusahaan']['nama']; ?><br/></h4>

                    <div class="row">
                        <div class="span2 logoagen">
                            <?php
                            $url = "";
                            if ($output['perusahaan']['picture'] != "") {
                                $url = base_url() . 'pictures/perusahaan/' . $output['perusahaan']['picture'];
                            } else {
                                $url = base_url() . 'assets/img/buildings_icon.png';
                            }
                            ?>
                            <img src="<?php echo $url; ?>" class="img-polaroid" width="100px" height="100px">

                        </div>
                        <div class="detilagen">
                            <p class="palette-paragraph">
                                <?php
                                echo $output['perusahaan']['alamat']['jalan'] . ', ' . $output['perusahaan']['alamat']['kota_kab'] .
                                ', ' . $output['perusahaan']['alamat']['provinsi'];
                                ?><br/>
                                Office: <?php echo $output['perusahaan']['no_telp']; ?> <br/>
                                Fax: <?php echo $output['perusahaan']['fax']; ?>
                            </p>
                        </div>
                    </div>
                </div>

                
            </div>
        </div>
    </div>
</div>
<div id="hubungiAgen" class="modal hide fade" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
        <h4 id="myModalLabel">Kontak Agen</h4>
    </div>
    <form action="" id="input-form" class="form-horizontal">
        <div class="modal-body">             
            <div class="control-group">
                <label class="control-label" for="titel">Titel:</label>
                <div class="controls">
                    <select name="titel" id="titel" class="span3">
                        <option value="0">Bapak</option>
                        <option value="1">Ibu</option>
                        <option value="2">Sdr/i</option>
                    </select>
                </div> 
            </div>
            <div class="control-group">
                  <label class="control-label" for="name">Nama:</label>
                  <div class="controls">
                    <input type="text" class="input-xlarge" name="name" id="name">
                  </div>
            </div>
            <div class="control-group">
                  <label class="control-label" for="name">Alamat E-mail:</label>
                  <div class="controls">
                    <input type="text" class="input-xlarge" name="email" id="email">
                  </div>
            </div>
            <div class="control-group">
                  <label class="control-label" for="tel">No. HP:</label>
                  <div class="controls">
                    <input type="tel" class="input-xlarge" name="tel" id="tel">
                  </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="sayaAdalah">Saya Adalah:</label>
                <div class="controls">
                    <select name="sayaAdalah" id="sayaAdalah" class="span3">
                        <option value="0">Pembeli</option>
                        <option value="1">Pemilik</option>
                        <option value="2">Penyewa</option>
                        <option value="3">Agen</option>
                        <option value="4">Investor</option>
                        <option value="5">Lain-lain</option>
                    </select>
                </div> 
            </div>
            <div class="control-group">
                  <label class="control-label" for="tel">Pesan"</label>
                  <div class="controls">
                    <textarea style="width:300"></textarea>
                  </div>
            </div>
            <label class="checkbox" for="checkbox_berlangganan">
                <input type="checkbox" name="mau_proyek" for="mau_proyek" value="1" id="checkbox_berlangganan" data-toggle="checkbox">
                Saya ingin menerima news letter dari Anda
            </label>
            <label class="checkbox" for="checkbox_info_baru">
                <input type="checkbox" name="mau_info" for="mau_info" value="1" id="checkbox_info_baru" data-toggle="checkbox">
                Saya ingin menerima property news Alert dari ArtyProperty.Com
            </label>
            <div class="span4 offset2">
                <input type="submit" name="SUBMIT"  class="btn btn-primary btn-large span3" value="Submit" />
            </div>
        </div>
    </form>
</div>

<!-- 
<h2>Detail Properti <?php echo $detail->nama_properti; ?></h2>
<div>
<h3>Foto properti</h3>
<img src="<?php echo $detail->url; ?>" height="200" width="350" alt="<?php echo $detail->judul_media; ?>"/><br/>
</div>

<div>
<h3>Deskripsi properti</h3>
<div>
<?php echo $detail->deskripsi; ?>
</div>

<h3>Detail properti</h3>
diiklankan sejak: <?php echo $detail->tgl_upload; ?><br/>
tipe properti: <?php echo $detail->tipe; ?> <br/>
harga: <?php echo $detail->harga; ?><br/>
kamar tidur: <?php echo $detail->jml_kmr_tidur; ?><br/>
kamar mandi: <?php echo $detail->jml_kmr_mandi; ?><br/>
kamar pembantu: <?php echo $detail->jml_kmr_pembantu; ?><br/>
fasilitas: <?php
$fas = array('kolam renang' => $detail->kolam_renang,
    'gym' => $detail->gym,
    'sauna' => $detail->sauna,
    'jogging track' => $detail->jogging_track,
    'function room' => $detail->function_room,
    'children playground' => $detail->children_playground,
    'ATM' => $detail->atm,
    'mini market' => $detail->mini_market,
    'perpustakaan' => $detail->library,
    'shopping center' => $detail->shopping_center,
    'entertainment center' => $detail->entertainment_center);

foreach ($fas as $key => $val) {
    if ($val) {
        echo '- ' . $key . '<br/>';
    }
}
?> <br/>
informasi sekolah dan rumah sakit: <?php echo $detail->info_sekolah_rs; ?><br/>
detail interior: <?php echo $detail->info_interior; ?><br/>
luas tanah: <?php echo $detail->luas_tanah; ?><br/>
luas bangunan: <?php echo $detail->luas_bangunan; ?><br/>
tahun didirikan: <?php echo $detail->tahun_didirikan; ?><br/>
sertifikat: <?php echo $detail->sertifikasi; ?><br/>
furnitur: <?php echo $detail->furnitur; ?><br/>
alamat: <?php echo $detail->jalan; ?><br/>
kota/kab : <?php echo $detail->kota_kab; ?><br/>
provinsi: <?php echo $detail->provinsi; ?><br/>
</div>

<div>
    <h3>Detail agen</h3>
    nama agen: <?php echo $detail->nama_depan . ' ' . $detail->nama_belakang; ?><br/>
    HP: <?php echo $agen->no_hp; ?> <br/>
    profil agen: <?php echo $agen->profil; ?><br/>
    listing aktif dari agen: <?php echo $jml_listing; ?> <br/>
    <form>
        disini form untuk kontak agen
    </form>
</div>

<div>
    <h3>Agensi</h3>
    nama agensi: <?php echo $agen->nama_perusahaan; ?><br/>
    logo agensi: <?php echo $agen->url_logo_perusahaan; ?><br/>
    alamat: <?php echo $agen->jalan . ', ' . $agen->kota_kab . ', ' . $agen->provinsi; ?><br/>
    office: <?php echo $agen->telp_kantor; ?> <br/>
    fax: <?php echo $agen->fax; ?><br/>
</div> -->
